<html>
<head><meta charset="utf-8"><title>VS Code syntax · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html">VS Code syntax</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="166157751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166157751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166157751">(May 21 2019 at 09:53)</a>:</h4>
<p>Hello! Do you have any plans regarding the syntax highlighting support for Code? Right now it seems a bit worse than the default TextMate syntax</p>



<a name="166157785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166157785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166157785">(May 21 2019 at 09:53)</a>:</h4>
<p>I do have a WIP patch that improves things a little, but it won't be enough</p>



<a name="166157859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166157859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166157859">(May 21 2019 at 09:54)</a>:</h4>
<p>I've opened <a href="https://github.com/rust-analyzer/rust-analyzer/issues/1294" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/1294">https://github.com/rust-analyzer/rust-analyzer/issues/1294</a> just now :-)</p>



<a name="166157871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166157871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166157871">(May 21 2019 at 09:54)</a>:</h4>
<p>Yeah, I added the ThemeColor thing</p>



<a name="166157881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166157881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166157881">(May 21 2019 at 09:55)</a>:</h4>
<p>and a light theme that more or less matches the default one</p>



<a name="166157894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166157894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166157894">(May 21 2019 at 09:55)</a>:</h4>
<p>We should improve highlighintg quite a bit, both in terms of how we interract with VS Code and what the user sees, as well as internally, in terms of how syntax highlighting is implemented</p>



<a name="166157897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166157897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166157897">(May 21 2019 at 09:55)</a>:</h4>
<p>one remaining issue is that it doesn't highlight types</p>



<a name="166157969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166157969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166157969">(May 21 2019 at 09:56)</a>:</h4>
<blockquote>
<p>one remaining issue is that it doesn't highlight types</p>
</blockquote>
<p>There's so many things we can highlight better</p>



<a name="166157988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166157988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166157988">(May 21 2019 at 09:56)</a>:</h4>
<p>the top one for me would be to underlying <code>mut</code> variables and variables with <code>&amp;mut</code> type</p>



<a name="166158002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166158002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166158002">(May 21 2019 at 09:56)</a>:</h4>
<p>yeah, that would be interesting</p>



<a name="166158006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166158006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166158006">(May 21 2019 at 09:56)</a>:</h4>
<p>maybe <code>unsafe</code> too</p>



<a name="166158054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166158054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166158054">(May 21 2019 at 09:57)</a>:</h4>
<p><a href="/user_uploads/4715/4AC-_s2j-BeezTLYdGbD1EKh/pasted_image.png" target="_blank" title="pasted_image.png">pasted image</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/4AC-_s2j-BeezTLYdGbD1EKh/pasted_image.png" target="_blank" title="pasted image"><img src="/user_uploads/4715/4AC-_s2j-BeezTLYdGbD1EKh/pasted_image.png"></a></div>



<a name="166158057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166158057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166158057">(May 21 2019 at 09:58)</a>:</h4>
<p>here's a quick preview</p>



<a name="166158384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166158384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166158384">(May 21 2019 at 10:02)</a>:</h4>
<p>Looks good! Can you send a PR with ThemeColor?</p>
<p>If you are interested in improving the internal  implementation, I can write some mentoring instructions as well!</p>



<a name="166158433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166158433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166158433">(May 21 2019 at 10:03)</a>:</h4>
<p>I'll file one when it's in a better shape. It's still missing a high contrast set of colors and I'm pretty bad at picking them</p>



<a name="166158659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166158659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166158659">(May 21 2019 at 10:06)</a>:</h4>
<p>Thanks!</p>



<a name="166162112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166162112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166162112">(May 21 2019 at 11:07)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/pull/1299" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/pull/1299">https://github.com/rust-analyzer/rust-analyzer/pull/1299</a></p>



<a name="166170785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166170785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166170785">(May 21 2019 at 13:14)</a>:</h4>
<p>Can I get rid of the <code>background</code> color? I don't see where it's used</p>



<a name="166170854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166170854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166170854">(May 21 2019 at 13:16)</a>:</h4>
<p>I think you can: iirc, it's the editor how controls the background</p>



<a name="166171160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166171160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166171160">(May 21 2019 at 13:19)</a>:</h4>
<p>the one here? <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/editors/code/src/highlighting.ts#L22" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/master/editors/code/src/highlighting.ts#L22">https://github.com/rust-analyzer/rust-analyzer/blob/master/editors/code/src/highlighting.ts#L22</a></p>



<a name="166171166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166171166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166171166">(May 21 2019 at 13:19)</a>:</h4>
<p>I thought they are emitted by RA</p>



<a name="166171254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166171254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166171254">(May 21 2019 at 13:20)</a>:</h4>
<p>I'm also not sure what <code>builtin</code> is</p>



<a name="166173843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166173843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166173843">(May 21 2019 at 13:51)</a>:</h4>
<p>can I check what a <code>NAME_REF</code> points to (function, type, variable)?</p>



<a name="166173883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166173883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166173883">(May 21 2019 at 13:51)</a>:</h4>
<p>Yeah, and that's the big part of "better highlighting"</p>



<a name="166173954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166173954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166173954">(May 21 2019 at 13:52)</a>:</h4>
<p>The rule should be that <code>NAME_REF</code> are colored into the same color as the thing they point to</p>



<a name="166174003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166174003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166174003">(May 21 2019 at 13:53)</a>:</h4>
<p>That's not a simple change of the current code. See how goto_definition works, to learn about the API</p>



<a name="166174025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166174025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166174025">(May 21 2019 at 13:53)</a>:</h4>
<p>The TL;DR: is that we should go from syntax to hir, and do resolution there</p>



<a name="166174154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166174154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166174154">(May 21 2019 at 13:54)</a>:</h4>
<p>that will require doing name resolution for highlighting though -- should there be separate 'levels'? i.e. VSCode probably does simple regex-based (lexer level) highlighting for keywords, then we can do syntax based highlighting, and then semantic</p>



<a name="166174270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166174270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166174270">(May 21 2019 at 13:55)</a>:</h4>
<p>Yeah, that's the other bit of the plan: do highlighting in several phases: lexical, syntactical, semantic/diagnosict</p>



<a name="166174357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166174357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166174357">(May 21 2019 at 13:56)</a>:</h4>
<p>And yet another bit of a puzzle  is region-based highlighting: we should highilght only the vewiport</p>



<a name="166176442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166176442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166176442">(May 21 2019 at 14:16)</a>:</h4>
<p>I tried to cast the node to a <code>NameRef</code>, invoke the go to definition machinery, get a <code>NavigationTarget</code>, but I'm not sure what to do now (:</p>



<a name="166178312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166178312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166178312">(May 21 2019 at 14:37)</a>:</h4>
<p>ah, nice</p>



<a name="166178314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166178314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166178314">(May 21 2019 at 14:37)</a>:</h4>
<p><a href="/user_uploads/4715/utXOoUB0gB7mtNIXbpTwGyr0/pasted_image.png" target="_blank" title="pasted_image.png">pasted image</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/utXOoUB0gB7mtNIXbpTwGyr0/pasted_image.png" target="_blank" title="pasted image"><img src="/user_uploads/4715/utXOoUB0gB7mtNIXbpTwGyr0/pasted_image.png"></a></div>



<a name="166179514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166179514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166179514">(May 21 2019 at 14:50)</a>:</h4>
<p><span class="user-mention" data-user-id="203546">@Laurențiu Nicola</span> you shouldn't invoke go to definition machinery exactly, you should use the HIR API directly:</p>
<div class="codehilite"><pre><span></span>    if let Some(path) = name_ref.syntax().ancestors().find_map(ast::Path::cast) {
        if let Some(resolved) = analyzer.resolve_path(db, path) {
            match resolved {
                hir::PathResolution::Def(def) =&gt; return Exact(NavigationTarget::from_def(db, def)),
                hir::PathResolution::LocalBinding(pat) =&gt; {
</pre></div>



<a name="166179565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166179565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166179565">(May 21 2019 at 14:50)</a>:</h4>
<p>maybe we can extract some of that glue code into a module which is shared by both goto defenition and highlighting, but highlighting shouldn't be invoking goto def directly</p>



<a name="166179640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166179640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166179640">(May 21 2019 at 14:51)</a>:</h4>
<p>right, that makes sense</p>



<a name="166179710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166179710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166179710">(May 21 2019 at 14:52)</a>:</h4>
<p>can I just make a new <code>SourceAnalyzer</code>?</p>



<a name="166179805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166179805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166179805">(May 21 2019 at 14:53)</a>:</h4>
<p>I was using <code>reference_definition</code></p>



<a name="166179826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166179826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166179826">(May 21 2019 at 14:53)</a>:</h4>
<p>You can make something that wraps <code>SourceAnalyzer</code> and has methods like <code>classify_nameref</code></p>



<a name="166196550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166196550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166196550">(May 21 2019 at 18:00)</a>:</h4>
<div class="codehilite"><pre><span></span>      10571ms - handle_code_action
              0ms - diagnostics
</pre></div>



<a name="166196555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166196555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166196555">(May 21 2019 at 18:00)</a>:</h4>
<p>we need a way to disable these</p>



<a name="166196629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166196629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166196629">(May 21 2019 at 18:01)</a>:</h4>
<p>actually, it was just loading this time, I guess. but the diagnostics are slow at times</p>



<a name="166353636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166353636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166353636">(May 23 2019 at 12:00)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> The issue with highlighting <code>NAME</code> as <code>function</code> is that it will apply equally to function, type and struct names. I would prefer to have type names and references to them to have the same color</p>



<a name="166353706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166353706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166353706">(May 23 2019 at 12:00)</a>:</h4>
<p><a href="/user_uploads/4715/B9ny-x2O0HvZvM6V_1sLm7P0/pasted_image.png" target="_blank" title="pasted_image.png">pasted image</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/B9ny-x2O0HvZvM6V_1sLm7P0/pasted_image.png" target="_blank" title="pasted image"><img src="/user_uploads/4715/B9ny-x2O0HvZvM6V_1sLm7P0/pasted_image.png"></a></div>



<a name="166353746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166353746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166353746">(May 23 2019 at 12:01)</a>:</h4>
<p>Yeah, we should use something more precise than just "Name"</p>



<a name="166353747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166353747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166353747">(May 23 2019 at 12:01)</a>:</h4>
<p>It's probably fine short-term, though</p>



<a name="166353748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166353748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166353748">(May 23 2019 at 12:01)</a>:</h4>
<p>"function"</p>



<a name="166353755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166353755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166353755">(May 23 2019 at 12:01)</a>:</h4>
<p>but short-term, "function" is better than "text"</p>



<a name="166353816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166353816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166353816">(May 23 2019 at 12:02)</a>:</h4>
<p>same for things like</p>
<div class="codehilite"><pre><span></span>                    BIND_PAT@[3091; 3105)
                      NAME@[3091; 3105)
                        IDENT@[3091; 3105) &quot;TYPE_ALIAS_DEF&quot;
</pre></div>



<a name="166354067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166354067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166354067">(May 23 2019 at 12:06)</a>:</h4>
<p>Yeah, I thik we need something like "classify_name" as welll</p>



<a name="166354161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166354161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166354161">(May 23 2019 at 12:07)</a>:</h4>
<p>Next time :-). I'll update the test and hopefully we're good to go with this</p>



<a name="166354681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166354681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166354681">(May 23 2019 at 12:14)</a>:</h4>
<p>Gah, I wonder when the <code>Debug</code> comma change will hit stable</p>



<a name="166354723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166354723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166354723">(May 23 2019 at 12:15)</a>:</h4>
<p>This friday? Or is it in the next reelase?</p>



<a name="166354972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166354972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166354972">(May 23 2019 at 12:19)</a>:</h4>
<p>Yeah, it's in beta</p>



<a name="166360933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166360933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166360933">(May 23 2019 at 13:37)</a>:</h4>
<p>re <a href="https://github.com/rust-lang/rust/issues/1314" target="_blank" title="https://github.com/rust-lang/rust/issues/1314">#1314</a>, we'll still need to handle the case when <code>classify_name_ref</code> fails</p>



<a name="166361210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361210">(May 23 2019 at 13:40)</a>:</h4>
<p>Indeed... I think we need some variants like <code>UnresolvedPathSegment</code>, <code>UnresolvedFieldAccess</code>, etc. Actually, for FieldAccess we can do <code>FieldAccess(Option&lt;hir::StructField&gt;),</code>, that is, we can move <code>None</code> <em>inside</em> some of the variants</p>



<a name="166361275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361275">(May 23 2019 at 13:41)</a>:</h4>
<p>That sounds like a good idea</p>



<a name="166361415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361415">(May 23 2019 at 13:42)</a>:</h4>
<p>Also, this <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_api/src/name_ref_kind.rs#L26-L71" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_api/src/name_ref_kind.rs#L26-L71">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_api/src/name_ref_kind.rs#L26-L71</a> looks a bit weird</p>



<a name="166361444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361444">(May 23 2019 at 13:42)</a>:</h4>
<p>Shouldn't it try to resolve a path first, then handle function calls, macros, and the other things?</p>



<a name="166361586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361586">(May 23 2019 at 13:44)</a>:</h4>
<p>I would expect both <code>f()</code> and <code>m::f()</code> to go through the path logic, with <code>f</code> getting resolved as a function call at the end</p>



<a name="166361634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361634">(May 23 2019 at 13:45)</a>:</h4>
<p>That what actually happens</p>



<a name="166361649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361649">(May 23 2019 at 13:45)</a>:</h4>
<p>the only special case is <strong>method</strong> calls</p>



<a name="166361664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361664">(May 23 2019 at 13:45)</a>:</h4>
<p><code>x.foo()</code> is not the same as <code>(x.foo)()</code></p>



<a name="166361667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361667">(May 23 2019 at 13:45)</a>:</h4>
<p>so, you need to special case that</p>



<a name="166361739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361739">(May 23 2019 at 13:46)</a>:</h4>
<p>So it's for methods (not functions) and fields?</p>



<a name="166361756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361756">(May 23 2019 at 13:46)</a>:</h4>
<p>But there's also a case for macros</p>



<a name="166361783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361783">(May 23 2019 at 13:47)</a>:</h4>
<p>Hm, yeah, I think macros can be hadled slightly better</p>



<a name="166361789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361789">(May 23 2019 at 13:47)</a>:</h4>
<p>We should first fetch a path</p>



<a name="166361809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361809">(May 23 2019 at 13:47)</a>:</h4>
<p>and only then check path's parent and call either "resovle_path" or "resolve_macro"</p>



<a name="166361990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166361990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166361990">(May 23 2019 at 13:49)</a>:</h4>
<p>Yeah, something like that</p>



<a name="166389025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166389025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166389025">(May 23 2019 at 18:56)</a>:</h4>
<p>I wonder if parts of <code>completion_context.rs</code> could reuse the same logic</p>



<a name="166389058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166389058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166389058">(May 23 2019 at 18:56)</a>:</h4>
<p>That one also has a <code>classify_name_ref</code>, but it seems to operate only on the AST</p>



<a name="166448960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166448960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166448960">(May 24 2019 at 12:52)</a>:</h4>
<p><span class="user-mention" data-user-id="203546">@Laurențiu Nicola</span> I wondered that as well!</p>
<p>I think though that completion is a pretty unique subsystem, and it might want to do things differently (for example, it has to process two files, original one and the one with a fake identifier). So, while it seems like there's a duplication there, I think we shouldn't try to agressively remove it</p>



<a name="166448980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166448980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166448980">(May 24 2019 at 12:52)</a>:</h4>
<p>We definitelly want to employ <code>classify_name_ref</code> in hover though!</p>



<a name="166786833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166786833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166786833">(May 29 2019 at 06:09)</a>:</h4>
<p>Is there a reason why name resolution doesn't seem to work for <code>i32</code>?</p>



<a name="166786933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166786933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166786933">(May 29 2019 at 06:11)</a>:</h4>
<p>I mean, I imagine why, but is it tracked somewhere?</p>



<a name="166788193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788193">(May 29 2019 at 06:39)</a>:</h4>
<p><code>i32</code> is a primitive type, so there's nothing we can resolve it to.</p>



<a name="166788447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788447">(May 29 2019 at 06:45)</a>:</h4>
<p>OTOH, yeah, the resolver can returns something like "primitive type" here...</p>



<a name="166788598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788598">(May 29 2019 at 06:48)</a>:</h4>
<p>there's this issue that's visible in the HTML colorization, where types get assigned two tags</p>



<a name="166788604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788604">(May 29 2019 at 06:48)</a>:</h4>
<div class="codehilite"><pre><span></span>&lt;span class=&quot;keyword&quot;&gt;fn&lt;/span&gt; &lt;span class=&quot;function&quot;&gt;foo&lt;/span&gt;&amp;lt;&lt;span class=&quot;type type&quot;&gt;T&lt;/span&gt;&amp;gt;() -&amp;gt; &lt;span class=&quot;type&quot;&gt;T&lt;/span&gt; {
</pre></div>



<a name="166788721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788721">(May 29 2019 at 06:51)</a>:</h4>
<p>I think that's because they're handled twice, once as <code>TYPE_PARAM</code>, and once as a <code>NAME</code></p>



<a name="166788768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788768">(May 29 2019 at 06:52)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w">            </span><span class="n">TYPE_ALIAS_DEF</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">TYPE_ARG</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">TYPE_PARAM</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="s">&quot;type&quot;</span><span class="p">,</span><span class="w"></span>
</pre></div>



<a name="166788773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788773">(May 29 2019 at 06:52)</a>:</h4>
<p>Yeah, that's a common bug in this kind of code</p>



<a name="166788778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788778">(May 29 2019 at 06:52)</a>:</h4>
<p>Some logic for prioritization should be added</p>



<a name="166788794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788794">(May 29 2019 at 06:53)</a>:</h4>
<p>Or, we should just explicitly handle all named thigs</p>



<a name="166788796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788796">(May 29 2019 at 06:53)</a>:</h4>
<p>And it makes sense to remove that line, since (I imagine) we want to highlight terminals (if that's the correct term)</p>



<a name="166788799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788799">(May 29 2019 at 06:53)</a>:</h4>
<p>and <code>TYPE_PARAM</code> isn't one</p>



<a name="166788803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788803">(May 29 2019 at 06:53)</a>:</h4>
<p>Thats, we don't color name when we visit name, we color it when we visit type alias, function definition, struct definition, etc</p>



<a name="166788804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788804">(May 29 2019 at 06:53)</a>:</h4>
<p>but then things like <code>i32</code> won't be highlighted</p>



<a name="166788858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788858">(May 29 2019 at 06:54)</a>:</h4>
<p>but my gut feeling is that removing <code>TYPE_ALIAS_DEF | TYPE_ARG | TYPE_PARAM =&gt; "type",</code> is ok</p>



<a name="166788861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166788861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166788861">(May 29 2019 at 06:54)</a>:</h4>
<p>yeah, I meant the other way around (highlight names, not definitions)</p>



<a name="166789751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789751">(May 29 2019 at 07:13)</a>:</h4>
<p>So I remember a BUILTIN NodeKind that is not used, was it supposed to be used for primitive types or something else?</p>



<a name="166789816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789816">(May 29 2019 at 07:14)</a>:</h4>
<p>And I think there's no UNION_DEF</p>



<a name="166789833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789833">(May 29 2019 at 07:14)</a>:</h4>
<p>I wouldn't say that original kinds were really <em>supposed</em> to be used for anything. I think I've just copy-pasted them from fall, so, if something doesn't make sense, it probably indeed is senseless :)</p>



<a name="166789857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789857">(May 29 2019 at 07:15)</a>:</h4>
<p>Fair enough</p>



<a name="166789858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789858">(May 29 2019 at 07:15)</a>:</h4>
<p>I am not sure if we should color primitive types like ixx, fxx str and char specially</p>



<a name="166789867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789867">(May 29 2019 at 07:15)</a>:</h4>
<p>Like types, maybe? Or keywords</p>



<a name="166789915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789915">(May 29 2019 at 07:16)</a>:</h4>
<p>I think they should be just types</p>



<a name="166789920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789920">(May 29 2019 at 07:16)</a>:</h4>
<p>more specifically, structs</p>



<a name="166789923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789923">(May 29 2019 at 07:16)</a>:</h4>
<p>Yup</p>



<a name="166789934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789934">(May 29 2019 at 07:16)</a>:</h4>
<p>(I think we can color enums and structs differently, though I don't know if we nececssary should)</p>



<a name="166789951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789951">(May 29 2019 at 07:17)</a>:</h4>
<p>And that should be handled by type resolution, not in the grammar, right?</p>



<a name="166789963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789963">(May 29 2019 at 07:17)</a>:</h4>
<p>The primitives</p>



<a name="166789966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789966">(May 29 2019 at 07:17)</a>:</h4>
<p>Hm</p>



<a name="166789971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789971">(May 29 2019 at 07:17)</a>:</h4>
<p>not by the grammar, but not by the type resolution either</p>



<a name="166789973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166789973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166789973">(May 29 2019 at 07:18)</a>:</h4>
<p>I think this is the job of name resolution</p>



<a name="166790021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166790021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166790021">(May 29 2019 at 07:18)</a>:</h4>
<p>(although, I guess, currently this logic wrongly lives in type inference code, let me take a look)</p>



<a name="166790313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166790313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166790313">(May 29 2019 at 07:24)</a>:</h4>
<p>Yeah, the primitive type resolution currently lives in type inference, I think because the name resolution doesn't know about types and there's nothing 'intermediate' the primitives can resolve to</p>



<a name="166790426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166790426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166790426">(May 29 2019 at 07:26)</a>:</h4>
<p>TIL: this is valid rust: <code>pub use i32 as int;</code></p>



<a name="166790450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166790450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166790450">(May 29 2019 at 07:27)</a>:</h4>
<p>So, name resolution needs to learn about i32 and friends</p>



<a name="166794858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166794858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166794858">(May 29 2019 at 08:35)</a>:</h4>
<p>submitted <a href="https://github.com/rust-analyzer/rust-analyzer/issues/1340" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/1340">https://github.com/rust-analyzer/rust-analyzer/issues/1340</a></p>



<a name="166797160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166797160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166797160">(May 29 2019 at 09:10)</a>:</h4>
<p>maybe we should just give them a <code>StructId</code>?</p>



<a name="166797395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166797395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166797395">(May 29 2019 at 09:12)</a>:</h4>
<p>I was thinking about that, and builtins seems cleaner: with <code>StructId</code>, we'd have to assign them to a particular crate, handle <code>source</code>, etc</p>



<a name="166797429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166797429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166797429">(May 29 2019 at 09:13)</a>:</h4>
<p>Or you mean, assigning <code>StructId</code>, but <strong>not</strong> allowing to create a <code>Struct</code> of them?</p>



<a name="166797453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166797453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166797453">(May 29 2019 at 09:13)</a>:</h4>
<p>no, if we assign a <code>StructId</code> we need to allow creating a <code>Struct</code>... but yeah, maybe it's more trouble than it's worth</p>



<a name="166800885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166800885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166800885">(May 29 2019 at 10:07)</a>:</h4>
<p>This is nicely handled in Go. In the stdlib, they have stub like <code>extern type int;</code>, so primitive types have a real definition in stdlib</p>



<a name="166800888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/166800888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#166800888">(May 29 2019 at 10:07)</a>:</h4>
<p>this won't work for rust due to <code>no_core</code></p>



<a name="173663637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/173663637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#173663637">(Aug 20 2019 at 14:37)</a>:</h4>
<p>An update from Code: <a href="https://github.com/microsoft/vscode/issues/77140" target="_blank" title="https://github.com/microsoft/vscode/issues/77140">https://github.com/microsoft/vscode/issues/77140</a></p>



<a name="173669459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/173669459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#173669459">(Aug 20 2019 at 15:44)</a>:</h4>
<p>Oh neat. I haven't seen tree-sitter before.</p>



<a name="173669781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/173669781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#173669781">(Aug 20 2019 at 15:49)</a>:</h4>
<p>Tree-sitter is an absolute <span aria-label="fire" class="emoji emoji-1f525" role="img" title="fire">:fire:</span> !</p>



<a name="173669982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/173669982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#173669982">(Aug 20 2019 at 15:52)</a>:</h4>
<p>Is that a good <span aria-label="fire" class="emoji emoji-1f525" role="img" title="fire">:fire:</span> or a <span aria-label="trash can" class="emoji emoji-1f5d1" role="img" title="trash can">:trash_can:</span> <span aria-label="fire" class="emoji emoji-1f525" role="img" title="fire">:fire:</span>? The use of the indefinite article suggests the latter</p>



<a name="173670049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/173670049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#173670049">(Aug 20 2019 at 15:53)</a>:</h4>
<p>a good one!</p>



<a name="173670158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/VS%20Code%20syntax/near/173670158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/VS.20Code.20syntax.html#173670158">(Aug 20 2019 at 15:54)</a>:</h4>
<p>Fair enough!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>